package club.justwill.single.persistence.document;

import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by xiangnan on 16-1-14.
 */
@Document(collection = "project_support")
public class ProjectSupport extends MongoDocument {

    @Field("project_id")
    private Long projectId;

    @Field("get_financing")
    private Double getFinancing;

    @Field("people_num")
    private Integer peopleNum;

    @Field("support_user_list")
    private List<SupportUser> supportUserList;

    @Field("batch_no")
    private String batchNo;

    public ProjectSupport() {}
    public ProjectSupport(Long projectId, Double getFinancing, Integer peopleNum, Collection supportUserCollection) {
        setProjectId(projectId);
        setGetFinancing(getFinancing);
        setPeopleNum(peopleNum);
        setSupportUserList((List)supportUserCollection);
    }

    public Integer getPeopleNum() {
        return peopleNum;
    }
    public void setPeopleNum(Integer peopleNum) {
        this.peopleNum = peopleNum;
    }
    public List<SupportUser> getSupportUserList() {
        if(supportUserList == null) {
            supportUserList = new ArrayList<SupportUser>();
        }
        return supportUserList;
    }

    public void setSupportUserList(List<SupportUser> supportUserList) {
        this.supportUserList = supportUserList;
    }

    public Long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        if(projectId == null) {
            this.projectId = 0L;
        } else {
            this.projectId = projectId;
        }
    }

    public Double getGetFinancing() {
        return getFinancing;
    }

    public void setGetFinancing(Double getFinancing) {
        this.getFinancing = getFinancing;
    }

    public String getBatchNo() {
        return batchNo;
    }

    public void setBatchNo(String batchNo) {
        this.batchNo = batchNo;
    }
}
